///////////////////////////////////////////////////////////
//  CCreateChoiceView.h
//  Implementation of the Class CCreateChoiceView
//  Created on:      21-Sep-2013 9:37:40 AM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#if !defined(EA_A64603AB_D50F_4e36_8359_8A11DE7BFB13__INCLUDED_)
#define EA_A64603AB_D50F_4e36_8359_8A11DE7BFB13__INCLUDED_

#include "IViewCtrl.h"
#include "IChoices.h"
#include "IWindowDirector.h"

using namespace Data;

namespace UI
{
class CCreateChoiceView : public IViewCtrl
{

public:
  CCreateChoiceView(IWindowDirector* director);
	virtual ~CCreateChoiceView();
	virtual IViewCtrl::ViewType GetType() const;
	virtual void Initialize();
	virtual void Refresh();
	virtual void ShowView(bool show = true);
	bool OnClickedAdd(CButton* button);
	void OnClickedBack();
	bool OnClickedDelete(CButton* button);
	void SetChoices(IChoices* data);

private:
  bool OnClickedNevigationBar(CNavigationBar* navigationBar, int button);
  bool OnSelectedTable(CTable* table, int tab);
  bool OnClickedView(CView* view);

  void AppendTableItem(const char* name, const char* caption);
  void DeleteTableItem(int index);

private:
	IViewCtrl::ViewType       m_type;
	IChoices*                 m_choices;
	IWindowDirector*          m_parrentWnd;
  CTablePtr                 m_table;
  CTextFieldPtr             m_choiceTextField;
  CNavigationBarPtr         m_navigationBar;
  std::vector<CTableItemPtr> m_tableRows;
  int                       m_currentRow;
};
}
#endif // !defined(EA_A64603AB_D50F_4e36_8359_8A11DE7BFB13__INCLUDED_)
